package Books.Example;

import java.io.UnsupportedEncodingException;

/*	String(byte[]);
 *  String(byte[], int offset, int length)
 * 
 * 	public byte[] getBytes();
 * 	public byte[] getBytes(String charsetName);
 * */

public class Example8_7 {
	public static void main(String[] args) throws UnsupportedEncodingException {
		byte d[] = "Java你好".getBytes();
		System.out.println("数组d的长度是:" + d.length);
		
		String s = new String(d, 7, 3); //输出好
		System.out.println(s);
		
		s = new String(d, 0, 7);
		
		System.out.println(s); // 输出Java你
	}
}
